from django.db import models
import mongoengine
from mongoengine import *

from CarpoolWithFriends.settings import DBNAME
from CarpoolWithFriends.settings import HOST
from CarpoolWithFriends.settings import PORT

connect(DBNAME,host=HOST,port=PORT)

class Location(EmbeddedDocument):
	longitude = FloatField()
	latitude = FloatField()
	description = StringField()
	
class Carpool(Document):
	id = ObjectIdField()
	transcaction_id = ObjectIdField()
	initiator = ObjectIdField()
	init_is_provider = Boolean()
	init_time = DateTimeField()
	description = StringField()
	provider = ObjectIdField()
	requesters = ListField(ObjectIdField())
	status = StringField(max_length=16)
	from_location = EmbeddedDocumentField(Location)
	to_location = EmbeddedDocumentField(Location)
	depature_time = DateTimeField()
	arrival_time = DateTimeField()
	seat_num = IntField()
	seat_rem = IntField()
	unit_price = FloatField()
	pickup = BooleanField()